function before(node) {
    if (node) {
        console.log(node)
        before(node.left)
        before(node.right)
    }
}

function middle(node) {
    if (node) {
        middle(node.left)
        console.log(node)
        middle(node.right)
    }
}

function after(node) {
    if (node) {
        after(node.left)
        after(node.right)
        console.log(node)
    }
}